package org.ailuoli.guard.domain.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * <p>
 * description
 * </p>
 *
 * @author sander 2024/02/12
 */
@Getter
@RequiredArgsConstructor
public enum DeleteEnum {

    /**
     * 异常(未知状态)
     */
    ERROR(-1),

    /**
     * 默认：未删除
     */
    DEFAULT(0),

    /**
     * 未删除
     */
    FALSE(0),

    /**
     * 已删除
     */
    TRUE(1);

    private final int value;

    public boolean equals(Integer value) {
        return value != null && this.value == value;
    }

    public DeleteEnum of(int value) {
        for (DeleteEnum deleteEnum : DeleteEnum.values()) {
            if (deleteEnum.value() == value) {
                return deleteEnum;
            }
        }
        return ERROR;
    }

    public int value() {
        return value;
    }

}
